import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class homework1 {
	public static void main(String[] args) throws IOException {
		FileOutputStream fos = new FileOutputStream("D:\\mytest.txt");
		FileInputStream fis = new FileInputStream("D:\\mytest.txt");
		try {
			String words = "hello word!!";
			byte[] str = words.getBytes();
			fos.write(str);
			int data = 0;
			while ((data = fis.read()) != -1) {
				System.out.print((char) data);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			fos.close();
			fis.close();
		}
	}
}
